//
//  ViewController.swift
//  CTPhotoBrowser
//
//  Created by Andney Jack on 2021/2/24.
//

import SnapKit
import UIKit

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        loadUI()
    }

    private func loadUI() {
        let actionButton = UIButton(frame: .zero)
        actionButton.tag = 1
        actionButton.setTitle("下一页", for: .normal)
        actionButton.backgroundColor = RandomColor()
        actionButton.addTarget(self, action: #selector(buttonClick(_:)), for: .touchUpInside)
        view.addSubview(actionButton)

        actionButton.snp.makeConstraints { make in
            make.center.equalTo(view)
            make.width.equalTo(100)
            make.height.equalTo(44)
        }

        let indicatorView = CTPhotoBrowserIndicatorView(frame: CGRect(x: 60, y: 70, width: 90, height: 90))
        view.addSubview(indicatorView)
        indicatorView.progress = 0.3
    }

    @objc func buttonClick(_ sender: UIButton) {
        let vc = PictureTestViewController()
        vc.modalPresentationStyle = .fullScreen
        present(vc, animated: true, completion: nil)
    }
}
